package com.atguigu.guli.ai.test3;

// 单例模式：懒汉式
public class SingletonTest2 {
    public volatile static SingletonTest2 instance = new SingletonTest2();
    private SingletonTest2() {}
    public SingletonTest2 getInstance() {
        if (instance == null){
            synchronized (SingletonTest2.class){
                if (instance == null){
                    instance = new SingletonTest2();
                }
            }
        }
        return instance;
    }
}
